package com.javasm.transfer;

import com.javasm.domin.entity.AftersaleEnterDepot;
import com.javasm.domin.vo.AftersaleEnterDepotVo;
import com.javasm.mapper.DepotDictMapper;
import com.javasm.transfer.base.BaseTransfer;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.List;

import static com.javasm.common.dictionary.InitContext.dic;

/**
 * @Author：longjinyi
 * @Version：1.0
 * @Date：2022/1/17-21:29
 * @Since:jdk1.8
 * @Description:
 */
@Component
@RequiredArgsConstructor
public class AftersaleEnterDepotTransfer extends BaseTransfer<AftersaleEnterDepot,AftersaleEnterDepotVo> {

    private final DepotDictMapper depotDictMapper;

    @Override
    public List<AftersaleEnterDepotVo> toVO(List<AftersaleEnterDepot> list) {
        List<AftersaleEnterDepotVo> aftersaleEnterDepotVos = super.toVO(list);

        for (int i = 0; i < aftersaleEnterDepotVos.size(); i++) {

            AftersaleEnterDepot aftersaleEnterDepot = list.get(i);
            AftersaleEnterDepotVo aftersaleEnterDepotVo = aftersaleEnterDepotVos.get(i);

            if (aftersaleEnterDepot.getInType() !=null&& aftersaleEnterDepot.getInType() != 0) {
                aftersaleEnterDepotVo.setInType(dic.get(3).get(aftersaleEnterDepot.getInType()));
            }

            if (aftersaleEnterDepot.getInStatus() != null ) {
                String s = dic.get(1).get(aftersaleEnterDepot.getInStatus());
                aftersaleEnterDepotVo.setInStatus(dic.get(1).get(aftersaleEnterDepot.getInStatus()));
            }
        }

        return aftersaleEnterDepotVos;
    }
}
